My invention relates to the operation of data processing systems, in particular to the management of relational databases stored in the memory of such systems. The invention further relates to means to facilitate the interactive use and updating of such databases.
The invention is employed in a data processing system, having one or more terminals or consoles which provide display means and keyboard signal input means, and providing in storage physical records modeled as at least one relational database.
Among the individual ultimate users of the data processing system and database records are some users, such as clerks, who are not programmers. Such users wish to be able to use the system terminals to view displayed representations of the records stored in the data processing system memory, to select specific records or parts of records to view, to delete or modify physical records in the memory, or to add new physical records to the memory. For these purposes the physical records must be selected, accessed in the physical storage, and retrieved (copied), and representations of the retrieved records must be displayed to the user at one of the terminals in some predetermined display format.
To permit this use of the stored database records, there must be provided in the data processing system stored coded instructions which when executed by the data processing system cause representations of the physical records, as well as representations of signals input by the user through the keyboard, to be displayed in a particular format on the display. Further, there must be provided stored coded instructions which when executed by the data processing system cause the interpretation of the signals input by the user through the keyboard, and which cause the retrieval and modification of the physical records of the stored database in response to such input signals.
Such instructions, designed for a particular use of the records of a particular database, together comprise one of a class of programs known as "database applications programs", that is, programs used by the ultimate user of the data processing system to carry out the application desired by him on the stored physical records of a particular database.
The preparation of such applications programs has typically required weeks or months of effort by an applications programmer, followed by additional weeks to detect and eliminate errors in the program so that it becomes reliable and relatively error-free in use.
It is therefore desirable to provide means for simplifying the construction and operation of such database applications programs, and it is an object of my invention to provide such means.
As is well understood in the art, the user (or programmer) of a data processing system does not deal directly with the physical records stored in the system's memory. Rather, he deals with a model of such records, provided when neeeded by means of programming stored in the system's memory and executed by the processor as needed. Referring to FIG. 2, the physical records are stored on physical media, advantageously as magnetic signals stored on magnetic disks 24 comprising secondary memory 16. The magnetic signals are physically organized on disks 24 in a manner well understood in the art of managing such memory media. The particular organization of such signals, and the particular means of locating them and copying them into main memory 14, are highly dependent on the hardware aspects of the particular memory media employed.
Several models of the records are provided, having different degrees of abstraction from the underlying stored physical records. Briefly, these are (referring to FIG. 2): the "external" view (26 or 28), in which "external" or "logical" records are seen by a particular user; the "conceptual view" (30), in which "conceptual" records are seen, each external view being a subset of the conceptual view; and the "internal" view (32) in which "internal" or "stored" records are seen.
It will be recognized that, when the data processing system operates to construct and present for use the records of each view shown in FIG. 2, these records are at that time (during such use) represented within the data processing system by physical signals derived from the magnetic signals stored on disks 24. When such use is concluded, the constructed records are no longer physically represented within system 10. In contrast, the underlying physical records stored on disks 24 remain on the disks at all times, whether or not they are in use, until deleted or modified.
The signals representing the records as seen in the various views 26, 28, 30, and 32 are derived from the physical records stored on media 24 by the data processing system, by means of the operation of a database management system, in other words by the execution of a suitable stored program by processor 12. As seen in the conceptual showing of FIG. 3, the physical records on media 24 are physically written, copied, and deleted by the data processing system under the control of a program element known as an access method, in a manner well understood in the art, and forming no part of the present invention. The access method is regarded as presenting to the database management system "stored" or "internal" records corresponding to and derived from the physical records.
The "internal" view is not seen by the user of the database (although it may be known to a programmer using the system). Processor 12, operating according to other portions of the database management system program, constructs from the stored or internal records the records of the conceptual view and its subsets, the external views. The definitions of the conceptual records are independent of the storage structure or the strategy employed by the access method for efficiently locating and retrieving the physical records.
Records in a database may be related to other records in the database, and the relationship is of interest to the user of the database. The relationship is itself represented as an entity in the database.
It is well understoood in the database management art that the conceptual records of a database, and the relationships among them, may be organized or modeled in one of three possible ways, known as relational, hierarchical, and network models.
The present invention relates to the management of the records of a database modeled as a relational database.
The records of a relational database are conceptually organized as tables (also referred to as "relations". Referring to FIG. 4, a table (relation) of a relational database comprises a plurality of rows; each row is a record (or tuple) comprising a plurality of fields. All rows of a particular table have the same number of fields. The fields of the records are arranged in columns; a column is also referred to as an attribute. The elements of a column are all members of a class of such elements, referred to as a domain, and the column is named by a column heading (domain name). Each record includes one or more fields whose content is an index or key, to be used in uniquely identifying the record.
A crucial feature of relational data structure is that associations between rows (tuples) are represented solely by data values in columns drawn from a common domain, rather than in terms of the physical location on disk of the related records.
Relational databases have various advantages over the two alternative models. Generally speaking, while hierarchical and network databases are organized to make it efficient to deal with one record at a time and to obtain a single related record at a time, relational databases are organized to make it efficient to deal with a set of records at a time and to obtain a set of related records at a time.
It is an important aspect of the relational model that the tables (relations), if they conform with certain constraints, may be considered as mathematical elements, also called relations, as to which a rigorous mathematical treatment already exists. Hence, operations on the tables can be analyzed in terms of this mathematical theory, an advantage in clearly understanding the effects of such operations. In particular, representing the data in the form of uniformly defined sets makes possible a corresponding uniformity in the set of operators which transform the sets, which simplifies the task of providing program elements for controlling a data processing system to transform such sets. It is an object of my invention to extend this advantage to aspects of database maintenance where it has not previously been provided, by providing an enumerated relation.
During the operations involved in maintaining a relational database, several kinds of errors can occur. Certain errors are "fatal", that is, the operation of the data processing system cannot proceed at all (for example, a permanent error in the operation of the disk). Certain other errors are not fatal, but require correction before the operation can be continued. In an interactive system, such errors can be corrected by a terminal user.
In particular, there are two levels of such errors. At the first or field level, constraints on fields (for example, that a value entered into a given field be alphabetic or numeric) are violated. At the second or integrity level, more complex constraints are violated: for example, a record may be defined in the data dictionary as a parent record in a relationship, and there may be a constraint preventing deletion of a parent record it there are records present related as child records to the parent record. If the user attempts to delete the parent record when such child records are present, this is an error. It is desirable to provide means for detecting the error.
In interactive systems, both levels of errors are within a class of errors that can be corrected by an interactive user of the system; if an indication of the error is presented on the display, the user, by means of the keyboard, can correct the error, and operation of the system can continue.
It would therefore be desirable to provide means for detecting and presenting to the interactive user errors of the class that can be interactively corrected. It is an object of my invention to provide such means.